package cn.yuan.org.service.impl;

import cn.yuan.basic.service.impl.BaseServiceImpl;
import cn.yuan.basic.util.PageList;
import cn.yuan.org.domain.DictionaryType;
import cn.yuan.org.mapper.DictionaryTypeMapper;
import cn.yuan.org.query.Query;
import cn.yuan.org.service.IDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DictionaryTypeServiceImpl extends BaseServiceImpl<DictionaryType> implements IDictionaryTypeService {
    @Autowired
    private DictionaryTypeMapper dictionaryTypeMapper;

    @Override
    public PageList<DictionaryType> getDictionaryType(Query query) {
//        dictionaryTypeMapper.queryTotal();
//        dictionaryTypeMapper.queryPageData;
        return new PageList<DictionaryType>(dictionaryTypeMapper.queryTotal(),dictionaryTypeMapper.queryPageData(query));
    }

    @Override
    @Transactional
    public void save(DictionaryType dictionaryType) {
        dictionaryTypeMapper.save(dictionaryType);
    }

    @Override
    @Transactional
    public void update(DictionaryType dictionaryType) {
        dictionaryTypeMapper.update(dictionaryType);
    }

    @Override
    @Transactional
    public void delById(Long id) {
        dictionaryTypeMapper.removeById(id);
    }

    @Override
    @Transactional
    public void delByIds(List<Long> ids) {
        dictionaryTypeMapper.patchRemove(ids);
    }
}
